/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.gov.ana.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author lucas.nunes
 */
@Entity
@Table(name = "GEOFT_PAIS")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Pais.findAll", query = "SELECT p FROM Pais p"),
    @NamedQuery(name = "Pais.findByPaiCd", query = "SELECT p FROM Pais p WHERE p.paiCd = :paiCd"),
    @NamedQuery(name = "Pais.findByPaiConCd", query = "SELECT p FROM Pais p WHERE p.paiConCd = :paiConCd"),
    @NamedQuery(name = "Pais.findByPaiNm", query = "SELECT p FROM Pais p WHERE p.paiNm = :paiNm"),
    @NamedQuery(name = "Pais.findByPaiSg", query = "SELECT p FROM Pais p WHERE p.paiSg = :paiSg"),
    @NamedQuery(name = "Pais.findByPaiCdIso3166", query = "SELECT p FROM Pais p WHERE p.paiCdIso3166 = :paiCdIso3166"),
    @NamedQuery(name = "Pais.findByPaiArKm2", query = "SELECT p FROM Pais p WHERE p.paiArKm2 = :paiArKm2"),
    @NamedQuery(name = "Pais.findByPaiQtPopulacao", query = "SELECT p FROM Pais p WHERE p.paiQtPopulacao = :paiQtPopulacao"),
    @NamedQuery(name = "Pais.findByPaiGmPoligono", query = "SELECT p FROM Pais p WHERE p.paiGmPoligono = :paiGmPoligono")})
public class Pais implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "PAI_CD")
    private BigDecimal paiCd;
    @Basic(optional = false)
    @NotNull
    @Column(name = "PAI_CON_CD")
    private BigInteger paiConCd;
    @Size(max = 104)
    @Column(name = "PAI_NM")
    private String paiNm;
    @Size(max = 24)
    @Column(name = "PAI_SG")
    private String paiSg;
    @Size(max = 24)
    @Column(name = "PAI_CD_ISO_3166")
    private String paiCdIso3166;
    @Column(name = "PAI_AR_KM2")
    private BigDecimal paiArKm2;
    @Column(name = "PAI_QT_POPULACAO")
    private Long paiQtPopulacao;
    @Size(max = 4000)
    @Column(name = "PAI_GM_POLIGONO")
    private String paiGmPoligono;
    @OneToMany(mappedBy = "ufdRpaCd")
    private List<UnidadeFederacao> unidadeFederacaoList;

    public Pais() {
    }

    public Pais(BigDecimal paiCd) {
        this.paiCd = paiCd;
    }

    public Pais(BigDecimal paiCd, BigInteger paiConCd) {
        this.paiCd = paiCd;
        this.paiConCd = paiConCd;
    }

    public BigDecimal getPaiCd() {
        return paiCd;
    }

    public void setPaiCd(BigDecimal paiCd) {
        this.paiCd = paiCd;
    }

    public BigInteger getPaiConCd() {
        return paiConCd;
    }

    public void setPaiConCd(BigInteger paiConCd) {
        this.paiConCd = paiConCd;
    }

    public String getPaiNm() {
        return paiNm;
    }

    public void setPaiNm(String paiNm) {
        this.paiNm = paiNm;
    }

    public String getPaiSg() {
        return paiSg;
    }

    public void setPaiSg(String paiSg) {
        this.paiSg = paiSg;
    }

    public String getPaiCdIso3166() {
        return paiCdIso3166;
    }

    public void setPaiCdIso3166(String paiCdIso3166) {
        this.paiCdIso3166 = paiCdIso3166;
    }

    public BigDecimal getPaiArKm2() {
        return paiArKm2;
    }

    public void setPaiArKm2(BigDecimal paiArKm2) {
        this.paiArKm2 = paiArKm2;
    }

    public Long getPaiQtPopulacao() {
        return paiQtPopulacao;
    }

    public void setPaiQtPopulacao(Long paiQtPopulacao) {
        this.paiQtPopulacao = paiQtPopulacao;
    }

    public String getPaiGmPoligono() {
        return paiGmPoligono;
    }

    public void setPaiGmPoligono(String paiGmPoligono) {
        this.paiGmPoligono = paiGmPoligono;
    }

    @XmlTransient
    public List<UnidadeFederacao> getUnidadeFederacaoList() {
        return unidadeFederacaoList;
    }

    public void setUnidadeFederacaoList(List<UnidadeFederacao> unidadeFederacaoList) {
        this.unidadeFederacaoList = unidadeFederacaoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (paiCd != null ? paiCd.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pais)) {
            return false;
        }
        Pais other = (Pais) object;
        if ((this.paiCd == null && other.paiCd != null) || (this.paiCd != null && !this.paiCd.equals(other.paiCd))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.gov.ana.service.Pais[ paiCd=" + paiCd + " ]";
    }
    
}
